import 'package:flutter/material.dart';
import './ItemData.dart';

class ListItem extends StatelessWidget {
  final ItemData itemData;

  ListItem(this.itemData);

  @override
  Widget build(BuildContext context) {
    return Container(
        margin: const EdgeInsets.only(top: 16.0),
        decoration: BoxDecoration(boxShadow: [BoxShadow(
            color: Colors.black12,
            offset: Offset(0.0, 15.0), //阴影xy轴偏移量
            blurRadius: 10.0, //阴影模糊程度
            spreadRadius: 2.0 //阴影扩散程度
        )],
            image:DecorationImage(fit: BoxFit.cover,
            image: NetworkImage(itemData.imagePath
            )),
            borderRadius: BorderRadius.all(
              Radius.circular(15.0),
            ),
            color: Colors.blue),
        height: 200.0,
        child: Stack(
          children: <Widget>[
            Align(
              alignment: Alignment.topLeft,
              child: Column(crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Container(
                    padding: const EdgeInsets.only(
                        left: 16.0, top: 20.0, bottom: 8.0),
                    child: Text(
                      itemData.title,
                      style: TextStyle(fontSize: 24.0, color: Colors.white),
                    ),
                  ),
                  Container(
                    padding: const EdgeInsets.only(
                        left: 16.0),
                    child: Text(
                      itemData.subtitle1,
                      style: TextStyle(fontSize: 16.0, color: Colors.white),
                    ),
                  ),
                ],
              ),
            ),
            Align(
              alignment: Alignment.bottomLeft,
              child: Container(
                padding: const EdgeInsets.only(left: 16.0, bottom: 20.0),
                child: Text(
                  itemData.subtitle2,
                  style: TextStyle(color: Colors.white, fontSize: 14.0),
                ),
              ),
            ),
            Align(
              alignment: Alignment.topRight,
              child: Container(
                padding: const EdgeInsets.only(right: 20.0, top: 20.0),
                child: Icon(
                  Icons.more_vert,
                  color: Colors.white,
                  size: 30.0,
                ),
              ),
            )
          ],
        ));
  }
}
